package com.lxk.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author JohnSoybean
 * @create 2020/6/2 16:41
 * @description 分页实体类
 */
@Data
@NoArgsConstructor
public class PageModel<T> {
    private List<T> list;
    private Integer pageNum;
    private Integer pageSize;
    private Integer pages;
    private Long total;

    public PageModel(com.github.pagehelper.Page<T> page) {
        this.list = page.getResult();
        this.pageNum = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.pages = page.getPages();
        this.total = page.getTotal();
    }

    public PageModel(com.baomidou.mybatisplus.extension.plugins.pagination.Page<T> page) {
        this.list = page.getRecords();
        this.pageNum = (int) page.getCurrent();
        this.pageSize = (int) page.getSize();
        this.pages = (int) page.getPages();
        this.total = page.getTotal();
    }
}
